package com.prs.crm.dao.archives.impl;

import java.util.Collection;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.archives.ArchivesTypeDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.archives.ArchivesType;

public class ArchivesTypeDaoImpl extends BaseDaoImpl<ArchivesType> implements
		ArchivesTypeDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<ArchivesType> getAllArchivesType() {
		Criteria criteria = this.getSession()
				.createCriteria(ArchivesType.class);
		return criteria.list();
	}

	@SuppressWarnings("unchecked")
	@Override
	public Collection<ArchivesType> getRootArchivesType() {
		Criteria criteria=this.getSession().createCriteria(ArchivesType.class);
		criteria.add(Restrictions.isNull("parent"));
		return criteria.list();
	}
}
